/*
 * TimeInterval.java
 *
 * Created on June 1, 2007, 11:06 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package assistedpostagger;

import java.util.Date;

/**
 *
 * @author parezina
 */
public class TimeInterval {
    
    private Date startTime;
    private Date endTime;
    private long elapsedSeconds;
    
    /** Creates a new instance of TimeInterval */
    public TimeInterval() {
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public long getElapsedSeconds() {
        return elapsedSeconds;
    }

    public void setElapsedSeconds(long elapsedSeconds) {
        this.elapsedSeconds = elapsedSeconds;
    }
    
    public void startNow() {
        this.startTime = new Date();
    }
    
    public void endNow() {
        this.endTime = new Date();
    }
    
    public void computeInterval() {
        
        this.elapsedSeconds = endTime.getTime() - startTime.getTime();
        
    }
    
    public String toString() {
        
        String outString = "";
        
        outString += ("Start time: " + startTime.toString() + "\n");
        outString += ("End time: " + endTime.toString() + "\n");
        outString += ("Run time: " + Long.toString(elapsedSeconds) + " milliseconds\n");
                
        return outString;
        
    }
    
}
